We give a linear time algorithm which, given a simply connected
figure of the plane
divided into cells, whose boundary is crossed by some colored inputs
and outputs,
produces non-intersecting directed flow lines which match inputs and
outputs according
to the colors, in such a way that each edge of any cell is crossed by
at most one line. The main tool is the notion of height function,
previously introduced for tilings. It appears as an
extension of the notion of potential of a flow in a planar graph.